﻿using Brc_DSB.GetWayConfig.Model;
using IdentityServer4.Models;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Brc_DSB.GetWayConfig.ApiScope
{
    public class ApiScopeConfig
    {
        // scopes define the API resources in your system
        public static IEnumerable<ApiResource> GetApiResources()
        {
            return new List<ApiResource>
            {
                new ApiResource("brc_gateway_config_admin", "GateWay admin API")
            };
        }

        // clients want to access resources (aka scopes)
        public static IEnumerable<Client> GetClients()
        {
            // client credentials client
            return new List<Client>
            {
                new Client
                {
                    ClientId = "brc_gateway",
                    AllowedGrantTypes = GrantTypes.ClientCredentials,

                    ClientSecrets =
                    {
                        new Secret("brc_gateway".Sha256())
                    },
                    AllowedScopes = { "brc_gateway_config_admin" }
                }
            };
        }
    }
}
